package com.gai.emp.dao;

import com.gai.emp.entity.Emp;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface EmpDao2 {
    /**
     * 动态查询
     * @param e
     * @return
     */
//    List<Emp> getEmp(Emp e);

    /**
     * 动态更新
     * @param e
     * @return
     */
//    Integer updateEmp(Emp e);

    /**
     * 动态新增
     * @param e
     * @return
     */
//    Integer insertEmp(Emp e);

//    List<Emp> getEmpForMap(Map map);

    /**
     * 批量删除
     * @param eno
     * @return
     */
    @Delete("delete from emp where eno = #{eno}")
    Integer delEmp(Integer eno);

    /**
     * 查询所有
     * @return
     */
    @Select("select * from emp")
    List<Emp> getAll();

    /**
     * 条件查询
     * @param ename
     * @param pwd
     * @return
     */
    @Select("select * from emp where ename = #{ename} and pwd = #{pwd}")
    Emp login(@Param("ename") String ename, @Param("pwd") String pwd);

    /*
        select * from emp where ename = '${ename}'
        String sql = "select * from emp where ename =" + ename;
    */
}